package com.hs.spring_001.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.spring_001.entry.Users;
import com.hs.spring_001.mapper.UserMapper;
import com.hs.spring_001.service.UserService;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper mapper;

    @Override
    public List<Users> fidnAll() {
        return mapper.selectAll();
    }

    @Override
    public PageInfo<Users> findByPage(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Users> users = mapper.selectAll();
        return new PageInfo<>(users);
    }

    @Override
    public int addUser(Users users) {
        return mapper.insert(users);
    }

}
